import Vue from 'vue'
import App from './App.vue'
//引入vue-router模块
import Router from 'vue-router'
import Home from "./pages/Home";
import Order from "./pages/Order";
import Login from "./pages/Login"
Vue.use(Router)
import Axios from 'axios'
import VueAxios from 'vue-axios'
import ItemList from "./pages/ItemList";
import Register from "./pages/Register";
import UserpassReset from "./pages/UserPassReset";
import RegisterSuccess from "./pages/RegisterSuccess";
import Cart from "./pages/Cart";
import OrderList from "./pages/OrderList";
import UserCenter from "./pages/UserCenter";
import UserPassUpdate from "./pages/UserPassUpdate"
import ItemDetail from "./pages/ItemDetail";
import OrderConfirm from "./pages/OrderConfirm";
import Payment from "./pages/Payment";
//设置允许携带Cookie信息进行服务器session身份验证
Axios.defaults.withCredentials = true
//设置基础URL
Axios.defaults.baseURL= 'http://localhost:8088'
// Axios.defaults.baseURL= 'http://yfb.neuedu.com:8812'
Vue.use(VueAxios,Axios)

//配置路由组件
const routes = [
  {
  path: '/home',
  component: Home
  },
  {
    path: '/order',
    component: Order
  },
  {
    path:'/itemList',
    name:'itemList',
    component:ItemList
  },
  {
    path:'/login',
    component:Login
  },
  {
    path:'/register',
    component:Register
  },
  {
    path: '/userPassReset',
    component:UserpassReset
  },
  {
    path:'/registersuccess',
    component:RegisterSuccess
  },
  {
    path:'/cart',
    name: 'cart',
    component:Cart
  },
  {
    path:'/orderList',
    component:OrderList
  },
  {
    path: '/userCenter',
    component:UserCenter
  },
  {
    path:'/userPassUpdate',
    component:UserPassUpdate
  },
  {
    path:'/itemDetail',
    name:'itemDetail',
    component:ItemDetail
  },
  {
    path: '/orderConfirm',
    name: 'orderConfirm',
    component: OrderConfirm
  },
  {
    path: '/payment',
    name: 'payment',
    component: Payment
  },
  {
    path:'*',
    component:Home
  }
]

//创建一个router实例，创建时要传递所有的路由配置
const router = new Router({
  routes
})

new Vue({
  el: '#app',
  router,
  render: h => h(App)
})
